
class Arguments(object):

    def __init__(self, *type_list):
        self.type_list = type_list

    def check(*arg_list):
        return [t.value(a) for t, a in zip(type_list, arg_list)]



class ArgumentsRepeat(Arguments):

    def __init__(self, *type_list):

        super(ArgumentsRepeat, self).__init__(*type_list)

    def check(self, *arg_list):
        
        l = len(self.type_list)
        la = len(arg_list)

        if  la % l != 0:
            Exception("Wrong number of arguments")
            
        r = []
        [r.extend(f(*arg_list[i:i+l])) for i in range(0, la, l)]
        return r
    
    return _f


class ShapeDefinitions(object):

    def __init__(self):
        pass

    def define(self, shape_name,  args):
        pass
    


ds9_parser = RegionParser(shape_definition = ds9_shape_def)
